/*
 * LocationManager.h
 *
 *  Created on: 6 May 2017
 *      Author: yiming
 */

#ifndef KATRINA_GUI_INCLUDE_KATRINA_GUI_LOCATIONMANAGER_H_
#define KATRINA_GUI_INCLUDE_KATRINA_GUI_LOCATIONMANAGER_H_

#include <ros/ros.h>
#include <geometry_msgs/Pose.h>
#include <katrina_helper/KatrinaConsoleManager.h>
#include <iostream>
#include <fstream>
#include <boost/algorithm/string.hpp>


namespace Katrina
{
    namespace Visualization
    {
        class KatrinaPanel;
    }

    namespace Navigation
    {
        class KnownLocation
        {
            public:
                std::string name;
                geometry_msgs::Pose location;
        };

        class LocationManager
        {
            public:
                LocationManager();
                virtual ~LocationManager();

                bool initialise(const std::string &file);
                bool loadLocations(const std::string &file);
                bool saveLocations(const std::string &file);

                bool knowLocation(const std::string &name);
                bool getLocation(const std::string &name, geometry_msgs::Pose &location);
                std::map<std::string, KnownLocation> &getLocations();
                void addLocation(const std::string &name, const geometry_msgs::Pose &pose);
                void removeLocation(const std::string &name);
            protected:
                std::map<std::string, KnownLocation> locations_;
                std::map<std::string, KnownLocation> new_locations_;
        };

        typedef boost::shared_ptr<LocationManager> LocationManagerPtr;
    }
}

#endif /* KATRINA_RVIZ_PLUGIN_INCLUDE_KATRINA_RVIZ_PLUGIN_LOCATIONMANAGER_H_ */
